﻿using ABlog.Domain.Entity;
using ABlog.Domain.FormModel;
using ABlog.Domain.Repository;

namespace ABlog.Domain.Service
{
    public class CountryService : ICountryService
    {
        private readonly ICountryRepository _countryRepository;

        public CountryService(ICountryRepository countryRepository)
        {
            _countryRepository = countryRepository;
        }

        #region 添加国家
        /// <summary>
        /// 添加国家
        /// </summary>
        /// <param name="countryFormModel">国家信息</param>
        /// <returns></returns>
        public bool AddCountry(CountryFormModel countryFormModel)
        {
            _countryRepository.AddModel(new CountryEntity(countryFormModel.UserId,countryFormModel.Name));
            return _countryRepository.SaveChange() > 0;
        } 
        #endregion
    }
}
